<?php

session_start();

require_once '../header.php';
require_once 'array.php';
function __autoload($className)
	{
    	require_once('../class/' . $className . '.class.php');
	}
session::need_member();
if(!empty($_GET))
{
	
	
	unset($_SESSION["ccid"]);
	unset($_SESSION["moneyplus"]);
	unset($_SESSION["plan"]);
	unset($_SESSION["cc"]);
	$Country=null;
	$condition_later=null;
	$typecc=null;
	$State=null;
	$Dob=null;
	$Ssn=null;
	$ArrReturn=$_GET;
	$Country=$ArrReturn['country'];
	$typecc=$ArrReturn['typecc'];
	$Plan=$ArrReturn['plan'];
	$_SESSION["plan"]=$Plan;
	$State=$ArrReturn['state'];
	$Bincc=intval($ArrReturn['bin']);
	$Dob=$ArrReturn['dob'];
	$Ssn=$ArrReturn['ssn'];
	$VarCheck=$typecc.$Country.$Plan.$State.$Bincc.$Dob.$Ssn;
	$Check=verify::check($VarCheck);
	if(($Check==0)&&($Plan=='ourplan'))
	{
		$PriceBin=1;
		if($Country !=null)
		{
			$GetBinCountry=database::LimitQuery('prices',array(
			'select' => 'bin',
			'condition' => array(
			'country' => $Country
			)
			));
			if(empty($GetBinCountry))
			{
				$PriceBin=1;
			}
			else 
			{
				$PriceBin=$GetBinCountry[0]['bin'];
			}
			$Country="and country='".$Country."' ";
		}
		if($typecc != null)
		{
			$typecc="and typecc ='".$typecc."' ";
		}
		if($State != null)
		{
			$State="and state='".$State."' ";
		}
		if($Dob =='yes')
		{
			$Dob="and dob is not null ";
		}
		if($Dob =='no')
		{
			$Dob="";
		}
		if($Ssn == 'yes')
		{
			$Ssn="and ssn is not null";
		}
		if($Ssn == 'no')
		{
			$Ssn="";
		}
		$MoneyPlus=0;
		if($Bincc != null)
		{
			$lenght=strlen($Bincc);
			$MoneyPlus=($lenght-1)*$PriceBin;
			$condition_later="and ccnumber like '$Bincc%' ";
			
		}
		$_SESSION["moneyplus"]=$MoneyPlus;
		$condition=$Country.$typecc.$State.$condition_later.$Dob.$Ssn;
		$query="select ccid,lastname,ccnumber,exmonth,exyear,city,state,zip,price,country from ccinfo where userid=0 and orderid=0 $condition order by rand() limit 0,40";
		$ResultQuery=database::GetQueryResult($query,0,0);
		require_once '../html/showccinfo.php';
	}
	else 
	{
		echo "Choose The Plan First";
	}
	
	
}
else
{
	require_once '../html/buycc.php';
}

?>
<div id="freshcvvccinfo" ></div>